{% extends "base.html" %}

{% block title %}招收学生{% endblock %}

{% block content %}
<div class="container">
    <h2 class="mb-4">招收学生</h2>
    <div class="mb-3">
        <a href="{{ url_for('add_registration') }}" class="btn btn-primary">添加招生</a>
    </div>
    <div class="table-responsive">
        <table class="table table-striped">
            <thead>
                <tr>
                    <th>学生姓名</th>
                    <th>性别</th>
                    <th>年级</th>
                    <th>年份</th>
                    <th>学期</th>
                    <th>家长关系</th>
                    <th>操作</th>
                </tr>
            </thead>
            <tbody>
                {% for registration in registrations %}
                <tr>
                    <td>{{ registration.name }}</td>
                    <td>{{ registration.gender }}</td>
                    <td>{{ registration.grade }}</td>
                    <td>{{ registration.year }}</td>
                    <td>{{ registration.semester }}</td>
                    <td>{{ registration.parent_relation }}</td>
                    <td>
                        <a href="{{ url_for('edit_registration', id=registration.id) }}" class="btn btn-sm btn-primary">编辑</a>
                        <form action="{{ url_for('delete_registration', id=registration.id) }}" method="POST" style="display: inline;">
                            <button type="submit" class="btn btn-sm btn-danger" onclick="return confirm('确定要删除这条注册记录吗？')">删除</button>
                        </form>
                    </td>
                </tr>
                {% endfor %}
            </tbody>
        </table>
    </div>
</div>
{% endblock %} 